package com.example.moblie203zlw20216061300604;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class sqlistadpter {
   SQLiteOpenHelper sqLiteOpenHelper=null;
   SQLiteDatabase database;
   public void onpe(Context context){
       sqLiteOpenHelper=new Sqlist(context,"student.db",null,1);
       try {
            database=sqLiteOpenHelper.getWritableDatabase();
       }catch (Exception e){
            database=sqLiteOpenHelper.getReadableDatabase();
       }
   }
   public void off(Context context){
       try {
           sqLiteOpenHelper=null;
           database.close();
       }catch (Exception e){
           sqLiteOpenHelper=null;
           database.close();
       }
   }
   public boolean open(){
        if (database!=null){
            return   database.isOpen();
        }else {
            return false;
        }
   }
   public boolean isread(){
       if (database!=null){
           return database.isReadOnly();
       }else {
           return false;
       }
   }
   public int getversion(){
       if (database!=null){
           return database.getVersion();
       }else {
           return -1;
       }
   }
   public String path(){
       if (database!=null){
           return   database.getPath();
       }else {
           return "没有";
       }
   }
}
